var memoizer = function (memo, formule) {
    var recur = function (n) {
        var result = memo[n]
        if (typeof result !== 'number') {
            result = formule(recur, n)
            console.log(result);
            memo[n] = result
        }
        return result
    }
    return recur
}
var factorial = memoizer([2, 1], function (recur, n) {
    return n * recur(n - 1)
})
console.log(factorial(6));
